<?php
header('Content-Type:application/json');  //此声明非常重要
include('connect.php');

$openid=$_GET['useropenid'];
$sql="select time,emcplace,emcName from totalinfo where nowState='疏散中'";
$s = mysqli_fetch_all(mysqli_query($db,$sql),MYSQLI_ASSOC);
if($s[0]['time']!=null || $s[0]['emcplace']!=null)
{	
	$json['time']=$s[0]['time'];
	$json['emcplace']=$s[0]['emcplace'];
	$json['emcname']=$s[0]['emcName'];
	$sql="select choiceDoorPlace,choiceDoorName from userdoorchoice where userid='".$openid."'";
	// echo $sql;
	 $result = mysqli_fetch_all(mysqli_query($db,$sql),MYSQLI_ASSOC);
	 // echo $result[0]['fir'];
			if($result[0]['choiceDoorPlace']!=null){
				ob_clean(); 
				$json['outdoor']=$result[0]['choiceDoorPlace'];
				$json['doorname']=$result[0]['choiceDoorName'];
				$json['code']=1;
				echo json_encode($json);
			}else{
				ob_clean(); 
				$json['code']=0;
				echo json_encode($json);
			}
}else{
	ob_clean();
	$json['code']=-1;
	echo json_encode($json);
}

?>